// Author	: damphat@gmail.com
// Created	: 01/12/2008

#pragma once
#include "vn/NetCommon.h"
#include "vn/IPAddress.h"
#include "vn/Collections.h"


NET_BEGIN

COLLECTION_USING

class IPHostEntry {
public:
	IPHostEntry() {	}

	IPHostEntry(const hostent* ent) {
		CHECK_ARG_NOT_NULL(ent);
		HostName = ent->h_name;
		Char **p = ent->h_aliases;
		while(*p) {
			Aliases.Add(*p);
			p++;
		}
		//assert(ent->h_addrtype == );
		//length = ent->h_length;

		p = ent->h_addr_list;
		while(*p) {
			AddressList.Add(IPAddress(*p, ent->h_length));
			p++;
		}
	}

	virtual ~IPHostEntry() {
	}

public:
	String				HostName;
	Vector<String>		Aliases;
	Vector<IPAddress>	AddressList;
};

NET_END
